

** Affective Representation **
** Replication Materials


* FIGURE 1
{
use "[your file path]\Party Day Time Series.dta", clear

xtset mc_republican day_gps, daily

* Make sure Stata knows it's a daily date (if not already)
format day_gps %td

* Day of week (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
gen dow = dow(day_gps)
label define dowlbl 0 "Sun" 1 "Mon" 2 "Tue" 3 "Wed" 4 "Thu" 5 "Fri" 6 "Sat"
label values dow dowlbl
gen day = day(day_gps)

* Month number (1–12)
gen month = month(day_gps)

* Year (e.g. 2012)
gen year = year(day_gps)

foreach var of varlist anger_rate sadness_rate disgust_rate joy_rate anticipation_rate {
    tssmooth ma `var'90=`var', window(45 1 45)
}

twoway ///
    (tsline anger_rate90 if mc_republican==0, lcolor(blue)) ///
    (tsline anger_rate90 if mc_republican==1, lcolor(red)), ///
    title(Anger) ///
    aspectratio(.5) ///
    name(anger, replace) ///
    scheme(plotplain) ///
    ytitle(Percent of Words) ///
    xtitle("") ///
    legend(order(1 "Democrats" 2 "Republicans")) ///
    xline(`=td(6nov2012)' `=td(8nov2016)' `=td(3nov2020)' `=td(5nov2024)') ///
    xlabel( ///
        `=td(01jan2010)' ///
        `=td(01jan2011)' ///
        `=td(01jan2012)' ///
        `=td(01jan2013)' ///
        `=td(01jan2014)' ///
        `=td(01jan2015)' ///
        `=td(01jan2016)' ///
        `=td(01jan2017)' ///
        `=td(01jan2018)' ///
        `=td(01jan2019)' ///
        `=td(01jan2020)' ///
        `=td(01jan2021)' ///
        `=td(01jan2022)' ///
        `=td(01jan2023)' ///
        `=td(01jan2024)' ///
        `=td(01jan2025)', ///
        format(%tdCCYY) angle(45) ///
    )

twoway ///
    (tsline joy_rate90 if mc_republican==0, lcolor(blue)) ///
    (tsline joy_rate90 if mc_republican==1, lcolor(red)), ///
    title(Joy) ///
    aspectratio(.5) ///
    name(joy, replace) ///
    scheme(plotplain) ///
    ytitle(Percent of Words) ///
    xtitle("") ///
    legend(order(1 "Democrats" 2 "Republicans")) ///
    xline(`=td(6nov2012)' `=td(8nov2016)' `=td(3nov2020)' `=td(5nov2024)') ///
    xlabel( ///
        `=td(01jan2010)' ///
        `=td(01jan2011)' ///
        `=td(01jan2012)' ///
        `=td(01jan2013)' ///
        `=td(01jan2014)' ///
        `=td(01jan2015)' ///
        `=td(01jan2016)' ///
        `=td(01jan2017)' ///
        `=td(01jan2018)' ///
        `=td(01jan2019)' ///
        `=td(01jan2020)' ///
        `=td(01jan2021)' ///
        `=td(01jan2022)' ///
        `=td(01jan2023)' ///
        `=td(01jan2024)' ///
        `=td(01jan2025)', ///
        format(%tdCCYY) angle(45) ///
    )

grc1leg anger joy, scheme(plotplain)
clear
}




** MC-CONGRESS ANALYSIS **
**************************
use "[your file path]\MC Congress Email Data.dta", clear

** Models: Pooled with CD Fixed Effects
foreach var of varlist std_anger_rate std_disgust_rate std_sadness_rate std_anticipation_rate std_joy_rate {
reg `var' presparty houseparty votepct les seniority mc_republican female, cluster(bionum)
eststo `var'
xtreg `var' presparty houseparty votepct les seniority, fe
eststo fe_`var'
xtreg `var' presparty houseparty votepct c.presparty#c.votepct les seniority, fe
eststo i_`var'
quietly: margins, at(votepct = (40(5)100) presparty = (0 1))
marginsplot, scheme(plotplain) xtitle(Vote Share) ytitle(Predicted Value) title(`var') name(i_`var') ///
	recastci(rline) ciopts(lpattern(dash)) ///
	recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs10))
reg `var' presparty houseparty votepct c.presparty#c.votepct les seniority mc_republican female, cluster(bionum)
eststo p_`var'
quietly: margins, at(votepct = (40(5)100) presparty = (0 1))
marginsplot, scheme(plotplain) xtitle(Vote Share) ytitle(Predicted Value) title(`var') name(p_`var') ///
	recastci(rline) ciopts(lpattern(dash)) ///
	recast(line) plot1opts(lcolor(black)) plot2opts(lcolor(gs10))
xtreg `var' presparty cong_control c.presparty#c.cong_control votepct les seniority, fe
eststo c_`var'
}
** TABLE 1
estout fe_std_anger_rate ///
       fe_std_disgust_rate ///
	   fe_std_sadness_rate ///
	   fe_std_anticipation_rate ///
	   fe_std_joy_rate, ///
	   keep(presparty houseparty votepct les seniority _cons) cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2_w r2_b r2_o rho) 


** FIGURE 2
grc1leg p_std_anger_rate p_std_disgust_rate p_std_sadness_rate p_std_anticipation_rate p_std_joy_rate, scheme(plotplain)


** APPENDIX

*TABLE A1: DESCRIPTIVE STATISTICS
tabstat anger_rate sadness_rate anticipation_rate joy_rate pres_pct cong_pct ideo_pct party_pct tool_pct topic_pct, stat(min max mean p50 sd)

* TABLE A2: CORRELATIONS
pwcorr anger_rate fear_rate disgust_rate sadness_rate joy_rate anticipation_rate pres_pct cong_pct  topic_pct ideo_pct party_pct


* TABLE A4: INTERACTION OF PRESIDENT'S PARTY AND VOTE SHARE
estout p_std_anger_rate i_std_anger_rate ///
       p_std_disgust_rate i_std_disgust_rate ///
	   p_std_sadness_rate i_std_sadness_rate ///
	   p_std_anticipation_rate i_std_anticipation_rate ///
	   p_std_joy_rate i_std_joy_rate, ///
	   keep(presparty houseparty votepct c.presparty#c.votepct les seniority mc_republican female _cons) cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2 r2_w r2_b r2_o rho) 

* TABLE A5: INTERACTION OF PRESIDENT'S PARTY AND CONGRESSIONAL CONTROL
estout c_std_anger_rate ///
       c_std_disgust_rate ///
	   c_std_sadness_rate ///
	   c_std_anticipation_rate ///
	   c_std_joy_rate, ///
	   keep(presparty cong_control c.presparty#c.cong_control votepct les seniority _cons) cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2_w r2_b r2_o rho) 

* Two-Way Fixed Effects (MC and Cong dummies)
foreach var of varlist anger_rate anticipation_rate disgust_rate fear_rate joy_rate sadness_rate surprise_rate trust_rate negative_rate positive_rate {
egen st_`var' = std(`var')
}

foreach var of varlist st_anger_rate-st_positive_rate {
xtreg `var' presparty majority les, fe cluster(bionum)
eststo `var'
}
* TABLE 4
estout st_anger_rate st_disgust_rate st_fear_rate st_sadness_rate st_negative_rate st_anticipation_rate st_joy_rate st_positive_rate, drop(_cons) cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2) 
	   
	   
	   
clear

* TABLE A3: SENTENCE-LEVEL MODELS
import delimited "C:\Users\adamf\Dropbox\Incorrect Voting in Congress\Congressional Communication & Affective Intelligence\Data\dcinbox_sentences10K_coded.csv"
 
gen mc_republican = .
replace mc_republican = 1 if mc_party=="Republican"
replace mc_republican = 0 if mc_party!="Republican"


recode mc_republican (0 = 1) (1 = 0), gen(mc_democrat)

recode congress (111 112 113 114 117 118 = 1) (115 116 = 0), gen(dempres)
recode congress (111 116 117 = 1) (112 113 114 115 118 = 0), gen(demhouse)
recode congress (111 112 113 117 118 = 1) (114 115 116 = 0), gen(demsen)

gen presparty = .
replace presparty = 1 if dempres==mc_democrat
replace presparty = 0 if dempres!=mc_democrat

gen houseparty = .
replace houseparty = 1 if demhouse==mc_democrat
replace houseparty = 0 if demhouse!=mc_democrat

gen senparty = .
replace senparty = 1 if demsen==mc_democrat
replace senparty = 0 if demsen!=mc_democrat

gen majority = .
replace majority = houseparty if chamber=="House"
replace majority = senparty if chamber=="Senate"


foreach var of varlist anger disgust sadness anticipation joy {
gen `var'_rate = (`var'/wordcount)*100
}


foreach var of varlist anger_rate disgust_rate sadness_rate anticipation_rate joy_rate {
reg `var' prescount congcount ideocount partycount topiccount wordcount presparty majority mc_republican, cluster(id)
eststo `var'
}
estout anger_rate disgust_rate sadness_rate anticipation_rate joy_rate, cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2_a) 

clear


** FIGURES B1-B3

use "[your file path]\party valence by months since event.dta"

* Positive Emotions
twoway (lowess pos_in months_since if months_since<97, bwidth(.3)) ///
       (lowess pos_out months_since if months_since<97, bwidth(.3)) ///
	   (lowess pos_pass months_since if months_since<97, bwidth(.3)), ///
	   scheme(plotplain) yline(4.7) xlab(0(24)96)

* Negative Emotions
twoway (lowess neg_wonpres months_since if months_since<97, bwidth(.3)) ///
       (lowess neg_wonhouse months_since if months_since<97, bwidth(.3)) ///
	   (lowess neg_passedbill months_since if months_since<97, bwidth(.3)), ///
	   scheme(plotplain) yline(1.7) xlab(0(24)96)

	   
	   twoway (scatter neg_wonpres months_since if months_since<97) (lowess neg_wonpres months_since if months_since<97, bwidth(.3)),  scheme(plotplain) yline(1.7) xlab(0(24)96)
	   twoway (scatter neg_wonhouse months_since if months_since<97) (lowess neg_wonhouse months_since if months_since<97, bwidth(.3)),  scheme(plotplain) yline(1.7) xlab(0(24)96)
	   twoway (scatter neg_passedbill months_since if months_since<97) (lowess neg_passedbill months_since if months_since<97, bwidth(.3)),  scheme(plotplain) yline(1.7) xlab(0(24)96)

       (scatter neg_wonhouse months_since if months_since<97) ///
	   (scatter neg_passedbill months_since if months_since<97), ///
	   scheme(plotplain) yline(1.7) xlab(0(24)96)


* B1a
twoway (lowess pos_in months_since if months_since<49 & months_since>0, bwidth(.3)) ///
       (lowess pos_out months_since if months_since<49 & months_since>0, bwidth(.3)), ///
	   scheme(plotplain) yline(4.79) xlab(0(12)48) name(pos_pres) ytitle(Percent Positive Words) legend(order(1 "Party Won Presidential Electdion" 2 "Party Lost Presidential Election"))
* B1b
twoway (lowess neg_in months_since if months_since<49 & months_since>0, bwidth(.3)) ///
       (lowess neg_out months_since if months_since<49 & months_since>0, bwidth(.3)), ///
	   scheme(plotplain) yline(1.7) xlab(0(12)48) name(neg_pres) ytitle(Percent Negative Words) legend(order(1 "Party Won Presidential Electdion" 2 "Party Lost Presidential Election"))

* FIGURE B1	   
grc1leg pos_pres neg_pres, scheme(plotplain) 


* B2a
twoway (lowess pos_maj months_since if months_since<24 & months_since>0, bwidth(.3)) ///
       (lowess pos_min months_since if months_since<24 & months_since>0, bwidth(.3)), ///
	   scheme(plotplain) yline(4.79) ylab(4.5(.1)5.1) xlab(0(6)24) name(pos_house) ytitle(Percent Positive Words) legend(order(1 "Party Won House Majority" 2 "Party Lost House Majority"))
* B2b
twoway (lowess neg_maj months_since if months_since<24 & months_since>0, bwidth(.3)) ///
       (lowess neg_min months_since if months_since<24 & months_since>0, bwidth(.3)), ///
	   scheme(plotplain) yline(1.7) ylab(1.5(.1)1.9) xlab(0(6)24) name(neg_house) ytitle(Percent Negative Words) legend(order(1 "Party Won House Majority" 2 "Party Lost House Majority"))

* FIGURE B2
grc1leg pos_house neg_house, scheme(plotplain) 


* B3a
twoway (lowess pos_pass months_since if months_since>0 & months_since<24, bwidth(.3)), ///
	scheme(plotplain) yline(4.79) ylab(4.5(.1)5.1) xlab(0(6)24) xtitle(Months Since Passed Bill) name(pos_pass)
	
twoway (lowess neg_pass months_since if months_since>0 & months_since<24, bwidth(.3)), ///
	scheme(plotplain) yline(1.7) ylab(1.5(.1)1.9) xlab(0(6)24) xtitle(Months Since Passed Bill) name(neg_pass)
	
grc1leg pos_pass neg_pass, scheme(plotplain)

clear

* B4
use "[your file path]\DC Inbox Emails 111 to 118.dta"
* Anger
reg st_anger_rate i.win_aca_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_anger_rate i.win_aca_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_aca_weeks 2.win_aca_weeks 3.win_aca_weeks ///
				   4.win_aca_weeks 5.win_aca_weeks 6.win_aca_weeks ///
				   7.win_aca_weeks 8.win_aca_weeks 9.win_aca_weeks ///
				   10.win_aca_weeks 11.win_aca_weeks) name(anger_aca) xtitle("Weeks Since ACA") ytitle("Predicted Value") title(Anger: ACA) yline(0) vert scheme(plotplain)

reg st_anger_rate i.win_tcja_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_anger_rate i.win_tcja_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_tcja_weeks 2.win_tcja_weeks 3.win_tcja_weeks ///
				   4.win_tcja_weeks 5.win_tcja_weeks 6.win_tcja_weeks ///
				   7.win_tcja_weeks 8.win_tcja_weeks 9.win_tcja_weeks ///
				   10.win_tcja_weeks 11.win_tcja_weeks) name(anger_tcja) xtitle("Weeks Since TCJA") ytitle("Predicted Value") title(Anger: TCJA) yline(0) vert scheme(plotplain)

reg st_anger_rate i.win_ira_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_anger_rate i.win_ira_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_ira_weeks 2.win_ira_weeks 3.win_ira_weeks ///
				   4.win_ira_weeks 5.win_ira_weeks 6.win_ira_weeks ///
				   7.win_ira_weeks 8.win_ira_weeks 9.win_ira_weeks ///
				   10.win_ira_weeks 11.win_ira_weeks) name(anger_ira) xtitle("Weeks Since IRA") ytitle("Predicted Value") title(Anger: IRA) yline(0) vert scheme(plotplain)

* Joy
reg st_joy_rate i.win_aca_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_joy_rate i.win_aca_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_aca_weeks 2.win_aca_weeks 3.win_aca_weeks ///
				   4.win_aca_weeks 5.win_aca_weeks 6.win_aca_weeks ///
				   7.win_aca_weeks 8.win_aca_weeks 9.win_aca_weeks ///
				   10.win_aca_weeks 11.win_aca_weeks) name(joy_aca) xtitle("Weeks Since ACA") ytitle("Predicted Value") title(Joy: ACA) yline(0) vert scheme(plotplain)

reg st_joy_rate i.win_tcja_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_joy_rate i.win_tcja_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_tcja_weeks 2.win_tcja_weeks 3.win_tcja_weeks ///
				   4.win_tcja_weeks 5.win_tcja_weeks 6.win_tcja_weeks ///
				   7.win_tcja_weeks 8.win_tcja_weeks 9.win_tcja_weeks ///
				   10.win_tcja_weeks 11.win_tcja_weeks) name(joy_tcja) xtitle("Weeks Since TCJA") ytitle("Predicted Value") title(Joy: TCJA) yline(0) vert scheme(plotplain)

reg st_joy_rate i.win_ira_weeks i.bionum if mc_republican==0, cluster(bionum)
eststo d
reg st_joy_rate i.win_ira_weeks i.bionum if mc_republican==1, cluster(bionum)
eststo r
coefplot (d, mcolor(blue) msymbol(O) ciopts(lcolor(blue))) ///
         (r, mcolor(red) msymbol(D) ciopts(lcolor(red))), ///
		 keep(1.win_ira_weeks 2.win_ira_weeks 3.win_ira_weeks ///
				   4.win_ira_weeks 5.win_ira_weeks 6.win_ira_weeks ///
				   7.win_ira_weeks 8.win_ira_weeks 9.win_ira_weeks ///
				   10.win_ira_weeks 11.win_ira_weeks) name(joy_ira) xtitle("Weeks Since IRA") ytitle("Predicted Value") title(Joy: IRA) yline(0) vert scheme(plotplain)
** FIGURE B4
grc1leg anger_aca anger_tcja anger_ira joy_aca joy_tcja joy_ira, scheme(plotplain)

clear


** TABLE B1
use "[your file path]\MC MONTH DCInbox.dta"

** Linear Time Structure MC fixed effects, separate modesl for pres party and majority
foreach var of varlist anger_rate disgust_rate fear_rate sadness_rate negative_rate joy_rate anticipation_rate positive_rate {
xtreg st_`var' c.presparty_elect##c.months_election months_passedbill majority_elect i.congress if presmonth!=1, fe cluster(bionum)
eststo pres_`var'
}

** Strong presidential effects, none for majority. Hot, unless you're into checks and balances.
** TABLE B1
estout pres_anger_rate pres_disgust_rate pres_fear_rate pres_sadness_rate pres_negative_rate pres_joy_rate pres_anticipation_rate pres_positive_rate, drop(111.congress 112.congress 113.congress 114.congress 115.congress 116.congress) cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N r2) 

